package com.xianyun.site.support.executor.query;

import com.alibaba.cola.dto.Response;
import com.xianyun.common.core.utils.bean.BeanUtils;
import com.xianyun.site.support.dto.SmtpCheckQry;
import com.xianyun.site.support.dto.clientobject.SmtpMessageCO;
import com.xianyun.site.support.gatewayimpl.SmtpGatewayImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 校验邮件
 * @author mac_zyj
 */
@Component
public class SmtpCheckQryExe {
    @Autowired
    private SmtpGatewayImpl smtpGateway;

    public Response execute(SmtpCheckQry qry) {
        //The flow of usecase is defined here.
        //The core ability should be implemented in Domain. or sink to Domain gradually
        SmtpMessageCO message = new SmtpMessageCO();
        BeanUtils.copyProperties(qry,message);
        return smtpGateway.checkSmtpCode(message);
    }
}
